﻿@using Easy.ViewPort.Descriptor
@model Object
@{
    var descriptor = ViewData.ModelMetadata.GetViewDescriptor() as DropDownListDescriptor;
    SelectList list = null;
    if (descriptor != null)
    {
        if (descriptor.SourceType == SourceType.ViewData)
        {
            list = new SelectList(ViewData[descriptor.SourceKey] as SelectList, "Value", "Text", Model);
        }
        else
        {
            list = new SelectList(descriptor.OptionItems, "Key", "Value", Model);
        }
    }
}
@Html.DropDownList("", list, descriptor?.ToHtmlProperties())